Skip to content

fix(core): a sealed scale resize shows its new scale once saved, not the old one - #8554

Merged
miguel-heygen merged 2 commits into
mainfrom
fix/sealed-draft-keeps-gsap-transform
Nov 23, 2026
Merged

miguel-heygen merged 2 commits into
mainfrom
fix/sealed-draft-keeps-gsap-transform

Conversation

@miguel-heygen

Copy link
Copy Markdown
Collaborator

What

In a sealed preview, a scale resize now shows its new scale and position as soon as it is saved. Since #8469 the preview put the layer back where it was before the drag, about 60 px from where it was dropped, until the page was reloaded. The saved file and an export were already right, and an unsealed preview was never affected.

Why

A sealed resize draws its size in the frame as a draft. When the size is saved as a GSAP scale, Studio cancels that draft (manualOffsetDraftEnd.ts, sizeSavedAsScale), and the frame puts back the inline styles the draft changed. #8469 added transform to that list, so a rotation drawn as a transform can be cancelled. But GSAP writes its scale and x/y into the same inline transform. So the cancel put back the transform from the start of the drag, over the scale and position GSAP had just drawn for the save.

Related work

Fixes the regression from #8469 for scale resizes; #8469's rotations behave as before.

How

packages/core/src/runtime/editingDraft.ts: a draft puts transform back only when it drew one itself, which only the rotation's transform route does. Once that rotation stops drawing and its transform is put back, a later cancel leaves transform alone, so it can't overwrite what GSAP draws after.

Test plan

  • Unit tests added/updated
  • Manual testing performed
  • Documentation updated (if applicable)
  • Comments follow CONTRIBUTING.md "Comments": they say why, not what, and a bug fix says what the code must do and how to reproduce the bug

fails without the fix: packages/core/src/runtime/editingDraft.test.ts, "leaves a transform it never drew to GSAP when it puts the rest back". On main the cancel puts back translate(10px, 0px) over GSAP's translate(30px, 0px) scale(1.5, 1.5).

With the fix, on a Linux machine: editingDraft.test.ts, editingAgent.test.ts (including #8469's rotation rows) and editingGestureStart.test.ts pass three runs in a row (199 tests). The push gate's named and covering files, core tsc, Fallow and pre-push are clean.

Bench

Edit-accuracy bench on a Linux machine, main at 35a0d81 with and without this change, the same bench for both: the 3 sealed scale resize cases and all 124 rotate cases (#8469's own), one run per mode. A case is off when any of tracking, teleport, drop or reload is over 1 px.

sealed, main sealed, this change unsealed, main unsealed, this change
cases off, of 127 4 1 0 0
resize-scale-px-r0-root-z100 after / mid / on, drop 60.15 / 60.09 / 59.99 0.06 / 0.19 / 0.24 0.23 or less 0.23 or less
the same, reload 60.21 / 60.16 / 60.19 0.24 or less 0.23 or less 0.23 or less
rotate cases off, of 124 1 (tracking 4.65, rotate-tween-xpercent-r0-root-z50) 0 0 0

A merge bisect of main into the scale fix's head, with this bench at every step, puts the start at #8469: the merge at the commit before it drops at 0.06 px, the merge at #8469 at 60.15 px.

Still off sealed with this change: resize-scale-px-r0-root-z100-on flashes back to its start position for one frame after release (teleport 60.14), then lands on the drop point. Before this change it stayed there.

No visible change

Sealed previews are off by default, so nothing changes for anyone yet. With them on, a scale-resized layer stays where it was dropped after the save.

@github-actions

Copy link
Copy Markdown
Contributor

Edit accuracy: accurate 271 (base branch 271), smooth 56 of those

The gate passes.
Smoothness is reported in the artifact, not gated. A case fails only if it fails 2 of 3 runs.

Quarantined, measured but not gated (0)

Unstable (1)

  • seqrotatenudge-none-px-r0-root-z100: tracking 0.03, pressJump 0, drop 0, reload 3.07, render 0.04, renderKey -, undo false, teleport true / tracking 0.03, pressJump 0, drop 0, reload 0, render 0.08, renderKey -, undo true, teleport true / tracking 0.03, pressJump 0, drop 0, reload 0, render 0.08, renderKey -, undo true, teleport true

@vanceingalls vanceingalls left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved at 6d569af, CI green. The first windows-latest: engine-cli-3 lane was cancelled at its 35-minute limit mid package-tests, so the aggregate failed. This PR touches only core's editingDraft runtime, main's Windows runs were green, and the rerun passed.

  • Fix: restore now skips transform unless the draft itself drew one. Only the rotation's transform route sets drewTransform, and clearing a rotation restores its transform before resetting the flag, so #8469's rotations keep their put-back. A scale resize's cancel (sizeSavedAsScale) no longer overwrites the scale and x/y GSAP just wrote into the same inline transform.
  • Evidence: the "fails without the fix" unit test shows exactly that overwrite on main (translate(10px, 0px) over GSAP's translate(30px, 0px) scale(1.5, 1.5)). The bench takes the sealed scale case from about 60 px to 0.06–0.24 px with all 124 rotate cases clean, and the merge bisect pins the start at #8469. The unsealed path is untouched.

Non-blocking: as the body says, resize-scale-px-r0-root-z100-on still flashes to its start for one frame after release (teleport 60.14) before landing. That's worth its own follow-up row.

@miguel-heygen
miguel-heygen added this pull request to the merge queue Nov 23, 2026
Merged via the queue into main with commit a50baed Nov 23, 2026
109 of 111 checks passed
@miguel-heygen
miguel-heygen deleted the fix/sealed-draft-keeps-gsap-transform branch November 23, 2026 03:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants